home *** CD-ROM | disk | FTP | other *** search
Text File | 2011-10-17 | 44.0 KB | 1,307 lines |
- package Forms
- {
- import Common.SoundManager;
- import caurina.transitions.Tweener;
- import flash.display.*;
- import flash.events.*;
- import flash.geom.*;
- import flash.media.SoundChannel;
- import flash.system.*;
- import flash.text.*;
- import flash.utils.Timer;
- import org.flintparticles.actions.*;
- import org.flintparticles.counters.*;
- import org.flintparticles.emitters.Emitter;
- import org.flintparticles.initializers.*;
- import org.flintparticles.renderers.*;
- import org.flintparticles.zones.*;
-
- [Embed(source="/_assets/assets.swf", symbol="Forms.DressupResultForm")]
- public class DressupResultForm extends CluelessBaseForm
- {
-
- public static const TIMER_HIGH_RATIO:Number = 0.75;
-
- public static const PARTNER_CUTSCENE_2:int = 20;
-
- public static const BOYFRIEND_ATTRIBUTE_BONUS:Number = 0;
-
- public static const TIMER_MID_BONUS:Number = 100;
-
- public static const PART_SHOE_GOOD_MINIMUM_SCORE:Number = 100;
-
- public static const PART_GOOD_MINIMUM_SCORE:Number = 300;
-
- public static const PARTNER_CUTSCENE_1:int = 10;
-
- public static const MIN_LIKE_COUNT:int = 3;
-
- public static const PARTNER_CHAT_INTERVAL:int = 1;
-
- public static const PARTNER_BONUS:Number = 200;
-
- public static const TIMER_MID_RATIO:Number = 0.5;
-
- public static const TIMER_HIGH_BONUS:Number = 200;
-
-
- internal var _nDisplayedScore:Number;
-
- public var _mcInsertion:MovieClip;
-
- internal var _nFinalScore:Number;
-
- public var _bDoubleDamage:PowerupDoubleDamage;
-
- internal var _bCherVOFashionRule:Boolean = false;
-
- internal var _iEffectDelay:int = 0;
-
- internal var _nFinalScoreMultiplier:Number = 1;
-
- internal var _bCherVONegative:Boolean = false;
-
- internal var _emitter:Emitter;
-
- public var _mcThumbnail:MCThumbnail;
-
- public var _mcPartnerLayer:MovieClip;
-
- public var _tfPlusMatch:TextField;
-
- public var _tfPlusBottom:TextField;
-
- public var _mcAffinityBar:TimerBarSmall;
-
- internal var _timer:Timer;
-
- public var _tfPartnerChat:TextField;
-
- public var _mcAccessory:DressupResultPart;
-
- public var _tfRanOutOfTime:TextField;
-
- public var _tfCherChat:TextField;
-
- public var _mcModelBackground:MovieClip;
-
- public var _tfLetter:TextField;
-
- internal const TIMER_INTERVAL:int = 200;
-
- public var _mcPlusPose:MovieClip;
-
- public var _cher:MovieClip;
-
- public var _mcBottom:DressupResultPart;
-
- public var _mcShoe:DressupResultPart;
-
- public var _mcPartnerChat:MovieClip;
-
- public var _mcTop:DressupResultPart;
-
- internal var _bPartnerVO:Boolean = false;
-
- public var _mcPowerupslot:MovieClip;
-
- public var _tfPlusTop:TextField;
-
- internal var _aScoreEffects:Array;
-
- internal var _dressupmodel:DressupModel;
-
- internal var _powerup:Powerup;
-
- public var _tfPowerupName:TextField;
-
- public var _mcHeart0:Heart;
-
- public var _mcBackground:MovieClip;
-
- public var _mcHeart2:Heart;
-
- internal var _nFinalGrade:Number;
-
- public var _tfModelName:TextField;
-
- public var _tfPoints:TextField;
-
- public var _mcHeart1:Heart;
-
- public var _tfTitle1:TextField;
-
- internal var nCount:int = 0;
-
- public var _bBack:ButtonRound;
-
- public var _mcDressupResultPartOk:MovieClip;
-
- internal var _nOriginalX:Number;
-
- internal var _nOriginalY:Number;
-
- public var _tfPlusPose:TextField;
-
- public var _mcCherChat:MovieClip;
-
- public var _rankdiamonds:MovieClip;
-
- public var _tfBack:TextField;
-
- internal var _aVoiceOvers:Array;
-
- public var _tfPlusTimer:TextField;
-
- public var _tfPerfectBonus:TextField;
-
- internal var _iScoringSpeed:int = 3;
-
- public var _tfAverage:TextField;
-
- public var _tfPlusShoe:TextField;
-
- internal var _dressuplevelinfo:DressupLevelInfo;
-
- internal var bTutorialCher:Boolean;
-
- internal var _nTimeFactor:Number = 1;
-
- internal var _dressuptheme:DressupTheme;
-
- internal var _nDisplayedScoreMultiplier:Number = 1;
-
- public var _tfPowerupText:TextField;
-
- public var _tfPlusRule:TextField;
-
- internal var _bCherVOPositive:Boolean = false;
-
- internal var bTutorial:Boolean;
-
- public var _mcPowerupBack:MovieClip;
-
- public var _mcModel:Model;
-
- public var _tfPlusPartner:TextField;
-
- public function DressupResultForm()
- {
- _iEffectDelay = 0;
- _nFinalScoreMultiplier = 1;
- _nDisplayedScoreMultiplier = 1;
- nCount = 0;
- _bCherVOPositive = false;
- _bCherVONegative = false;
- _bCherVOFashionRule = false;
- _bPartnerVO = false;
- _iScoringSpeed = 3;
- _nTimeFactor = 1;
- _aVoiceOvers = new Array();
- _emitter = new Emitter();
- super();
- }
-
- public static function getLetterGrade(param1:Number) : String
- {
- if(param1 > 96)
- {
- return "A+";
- }
- if(param1 > 92)
- {
- return "A";
- }
- if(param1 > 89)
- {
- return "A-";
- }
- if(param1 > 86)
- {
- return "B+";
- }
- if(param1 > 82)
- {
- return "B";
- }
- if(param1 > 79)
- {
- return "B-";
- }
- if(param1 > 76)
- {
- return "C+";
- }
- if(param1 > 72)
- {
- return "C";
- }
- if(param1 > 69)
- {
- return "C-";
- }
- if(param1 > 66)
- {
- return "D+";
- }
- if(param1 > 62)
- {
- return "D";
- }
- if(param1 > 59)
- {
- return "D-";
- }
- return "F";
- }
-
- public static function getLetterScore(param1:String) : Number
- {
- var _loc2_:Number = NaN;
- _loc2_ = 0;
- switch(param1)
- {
- case "A+":
- _loc2_ = 100;
- break;
- case "A":
- _loc2_ = 96;
- break;
- case "A-":
- _loc2_ = 92;
- break;
- case "B+":
- _loc2_ = 89;
- break;
- case "B":
- _loc2_ = 86;
- break;
- case "B-":
- _loc2_ = 82;
- break;
- case "C+":
- _loc2_ = 79;
- break;
- case "C":
- _loc2_ = 76;
- break;
- case "C-":
- _loc2_ = 72;
- break;
- case "D+":
- _loc2_ = 69;
- break;
- case "D":
- _loc2_ = 66;
- break;
- case "D-":
- _loc2_ = 62;
- break;
- case "F":
- _loc2_ = 59;
- break;
- default:
- _loc2_ = 0;
- }
- return _loc2_;
- }
-
- protected function ConvertPartScore(param1:int) : int
- {
- if(param1 > 499)
- {
- return 95;
- }
- if(param1 > 299)
- {
- return 85;
- }
- if(param1 > 199)
- {
- return 75;
- }
- if(param1 > 99)
- {
- return 65;
- }
- return 55;
- }
-
- protected function onScoreEffectClicked(param1:Event) : void
- {
- var _loc2_:Part = null;
- _loc2_ = (param1.currentTarget as ScoreEffect)._debug as Part;
- trace("Score was given for " + _loc2_.Template.Category);
- }
-
- protected function hideExtras() : void
- {
- _tfRanOutOfTime.visible = false;
- _bBack.visible = false;
- _tfBack.visible = false;
- _tfBack.mouseEnabled = false;
- _tfPlusTop.visible = false;
- _tfPlusBottom.visible = false;
- _tfPlusShoe.visible = false;
- _tfPlusPartner.visible = false;
- _mcPartnerLayer.visible = false;
- _mcPartnerChat.visible = false;
- _tfPartnerChat.visible = false;
- _mcHeart0.visible = false;
- _mcHeart1.visible = false;
- _mcHeart2.visible = false;
- _tfPlusTimer.visible = false;
- _tfPlusMatch.visible = false;
- _tfPlusPose.visible = false;
- _mcPlusPose.visible = false;
- _tfPlusRule.visible = false;
- _tfCherChat.visible = false;
- _mcCherChat.visible = false;
- _cher.visible = false;
- _tfPerfectBonus.visible = false;
- _bDoubleDamage.visible = false;
- }
-
- protected function showCher() : void
- {
- _tfPlusRule.visible = true;
- _tfCherChat.visible = true;
- _mcCherChat.visible = true;
- _cher.visible = true;
- if((Profile.CurrentProfile.TutorialMask & Profile.kTutorial_FashionStyle) == 0)
- {
- bTutorialCher = true;
- setTutorial(new MCTutorialFashionPopup());
- Profile.CurrentProfile.TutorialMask |= Profile.kTutorial_FashionStyle;
- }
- }
-
- protected function tweenBonus(param1:DisplayObject) : void
- {
- param1.visible = true;
- Tweener.addTween(param1,{
- "alpha":0,
- "time":8 * _nTimeFactor
- });
- Tweener.addTween(param1,{
- "y":param1.y - 200,
- "time":8 * _nTimeFactor
- });
- }
-
- protected function onTimer(param1:Event) : void
- {
- var _loc2_:Object = null;
- var _loc3_:ScoreEffect = null;
- var _loc4_:Function = null;
- var _loc5_:Object = null;
- if(_iEffectDelay > 0)
- {
- --_iEffectDelay;
- }
- else if(_aScoreEffects.length > 0)
- {
- _loc2_ = _aScoreEffects.pop();
- if(_loc2_ is ScoreEffect)
- {
- _loc3_ = _loc2_ as ScoreEffect;
- addChildAt(_loc3_,getChildIndex(_mcInsertion));
- _nDisplayedScore += _loc3_.start();
- }
- else if(_loc2_ is Function)
- {
- if((_loc5_ = (_loc4_ = _loc2_ as Function)()) is String)
- {
- _nDisplayedScoreMultiplier += parseFloat(_loc5_ as String);
- SoundManager.getInstance().playSound("ScoreFactorRevealedSound");
- }
- else
- {
- _nDisplayedScore += _loc5_ as Number;
- }
- }
- updateScore(_nDisplayedScore * _nDisplayedScoreMultiplier);
- }
- else
- {
- if(_nFinalScore < _nDisplayedScore)
- {
- throw "ERROR: Missing Final Score component " + _nFinalScore + " " + _nDisplayedScore;
- }
- if(_nFinalScore > _nDisplayedScore)
- {
- throw "ERROR: Missing Displayed Score component" + _nFinalScore + " " + _nDisplayedScore;
- }
- if(_nFinalScore * _nFinalScoreMultiplier >= 5000 && Profile.CurrentProfile.CuttingEdge == 0)
- {
- Profile.CurrentProfile.CuttingEdge = 1;
- AchievementsList.showAchievement("cutting edge");
- Storage.getInstance().saveProfiles();
- }
- _bBack.visible = true;
- _tfBack.visible = true;
- _tfBack.mouseEnabled = false;
- if((Profile.CurrentProfile.TutorialMask & Profile.kTutorial_DressupMask) == 0)
- {
- if(_mcTutorial == null)
- {
- setTutorial(new MCTutorialDressupResult());
- addSkipButton().addEventListener(MouseEvent.CLICK,onSkipTutorial,false,0,true);
- }
- }
- _timer.removeEventListener(TimerEvent.TIMER,onTimer,false);
- _timer.stop();
- }
- }
-
- protected function onAttributeScoresDone() : void
- {
- var _loc1_:DressupResultPart = null;
- var _loc2_:int = 0;
- var _loc3_:String = null;
- var _loc4_:SoundChannel = null;
- for each(_loc1_ in [_mcTop,_mcBottom,_mcShoe,_mcAccessory])
- {
- _loc1_.onFinishedScoreEffect();
- }
- _nFinalGrade = Math.ceil(_nFinalGrade / 3);
- _tfLetter.text = getLetterGrade(_nFinalGrade);
- _dressuplevelinfo.CurrentTotalLetterGrade += _nFinalGrade;
- _loc2_ = _dressuplevelinfo.TotalFigures - _dressuplevelinfo.FiguresLeft;
- if(_loc2_ > 0)
- {
- _tfAverage.text = getLetterGrade(_dressuplevelinfo.CurrentTotalLetterGrade / _loc2_);
- }
- if(MainDocument.VOICE_OVERS_ENABLED)
- {
- if(_tfLetter.text == "A" || _tfLetter.text == "A+")
- {
- if(!_bPartnerVO)
- {
- _bCherVOPositive = true;
- _loc3_ = "positive_" + int(Math.random() * 20 + 1);
- _loc4_ = SoundManager.getInstance().playSound(_loc3_);
- _aVoiceOvers.push(_loc4_);
- }
- }
- else if(_bCherVONegative)
- {
- _loc3_ = "negative_" + int(Math.random() * 14 + 1);
- _loc4_ = SoundManager.getInstance().playSound(_loc3_);
- _aVoiceOvers.push(_loc4_);
- }
- }
- }
-
- protected function showPowerup(param1:Powerup) : void
- {
- if(param1 != null)
- {
- _tfPowerupText.visible = true;
- _tfPowerupName.visible = true;
- _mcPowerupslot.visible = true;
- _mcPowerupBack.visible = true;
- _mcPowerupslot.addChild(param1);
- _tfPowerupName.text = param1.PowerupName;
- param1.scaleX = 20;
- param1.scaleY = 20;
- param1.alpha = 0;
- if(!(param1.PowerupName == "double" && _dressuplevelinfo.getLevelPartners().length > 0))
- {
- Tweener.addTween(param1,{
- "alpha":1,
- "time":0.25 * _nTimeFactor
- });
- }
- Tweener.addTween(param1,{
- "scaleX":2,
- "scaleY":2,
- "x":param1.x + 20,
- "y":param1.y + 20,
- "time":0.5 * _nTimeFactor
- });
- param1.mouseEnabled = false;
- SoundManager.getInstance().playSound("NewPowerupRevealedSound");
- }
- else
- {
- _tfPowerupText.visible = false;
- _tfPowerupName.visible = false;
- _mcPowerupslot.visible = false;
- _mcPowerupBack.visible = false;
- }
- }
-
- protected function getPartWithAttribute(param1:String) : Part
- {
- var _loc2_:String = null;
- var _loc3_:Part = null;
- for each(_loc2_ in ["top","bottom","shoe","accessory","dress","body"])
- {
- _loc3_ = _mcModel.getPart(_loc2_);
- if(_loc3_ != null)
- {
- if(_loc3_.Template.hasAttribute(param1))
- {
- return _loc3_;
- }
- }
- }
- return null;
- }
-
- protected function getDestination(param1:String) : DressupResultPart
- {
- switch(param1.toLowerCase())
- {
- case "top":
- case "dress":
- return _mcTop;
- case "bottom":
- return _mcBottom;
- case "shoe":
- return _mcShoe;
- case "accessory":
- return null;
- case "boyfriend":
- return _mcAccessory;
- default:
- return _mcAccessory;
- }
- }
-
- override public function onUnfocus() : void
- {
- var _loc1_:SoundChannel = null;
- super.onUnfocus();
- for each(_loc1_ in _aVoiceOvers)
- {
- if(_loc1_ != null)
- {
- _loc1_.stop();
- }
- }
- _aVoiceOvers = new Array();
- }
-
- protected function enqueueRuleMatch(param1:Rule) : void
- {
- var rule:Rule = param1;
- _aScoreEffects.push(function():*
- {
- var _loc1_:SoundChannel = null;
- showCher();
- _tfPlusRule.visible = true;
- _tfPlusRule.text = "Style Bonus +" + rule.Score;
- if(MainDocument.VOICE_OVERS_ENABLED)
- {
- if(!_bPartnerVO && !_bCherVOPositive)
- {
- _loc1_ = SoundManager.getInstance().playSound(rule.Voice);
- _aVoiceOvers.push(_loc1_);
- }
- }
- _tfCherChat.text = Localization.getString(rule.Comment);
- Tweener.addTween(_tfPlusRule,{
- "alpha":0,
- "time":8 * _nTimeFactor
- });
- Tweener.addTween(_tfPlusRule,{
- "y":_tfPlusRule.y - 300,
- "time":16 * _nTimeFactor
- });
- _nDisplayedScore += rule.Score;
- });
- _bCherVOFashionRule = true;
- _nFinalScore += rule.Score;
- }
-
- protected function showPartner(param1:String) : void
- {
- var liketext:String = null;
- var sc:SoundChannel = null;
- var sText:String = param1;
- SoundManager.getInstance().playSound("BoyfriendLovesOutfitSound");
- _bBack.visible = false;
- _tfBack.visible = false;
- _tfBack.mouseEnabled = false;
- _mcPartnerLayer.visible = true;
- if(nCount > PARTNER_CUTSCENE_1)
- {
- _mcPartnerLayer.gotoAndStop(_dressupmodel.PartnerName + "_2");
- }
- else
- {
- _mcPartnerLayer.gotoAndStop(_dressupmodel.PartnerName);
- }
- _mcPartnerChat.visible = true;
- _tfPartnerChat.visible = true;
- _mcHeart0.visible = true;
- _mcHeart1.visible = true;
- _mcHeart2.visible = true;
- Tweener.addTween(_mcHeart0,{
- "x":_mcAffinityBar.x,
- "time":1 * _nTimeFactor,
- "transition":"easeoutcirc"
- });
- Tweener.addTween(_mcHeart0,{
- "y":_mcAffinityBar.y,
- "time":1 * _nTimeFactor,
- "transition":"easeinoutsine"
- });
- Tweener.addTween(_mcHeart1,{
- "x":_mcAffinityBar.x,
- "time":1.5 * _nTimeFactor,
- "transition":"easeoutCubic"
- });
- Tweener.addTween(_mcHeart1,{
- "y":_mcAffinityBar.y,
- "time":1.5 * _nTimeFactor,
- "transition":"easeOutExpo"
- });
- Tweener.addTween(_mcHeart2,{
- "x":_mcAffinityBar.x,
- "time":2 * _nTimeFactor,
- "transition":"easeoutquart"
- });
- Tweener.addTween(_mcHeart2,{
- "y":_mcAffinityBar.y,
- "time":2 * _nTimeFactor,
- "transition":"easeOutCubic"
- });
- Tweener.addTween(_mcHeart2,{
- "alpha":0,
- "time":2.5 * _nTimeFactor,
- "transition":"easeinquart"
- });
- Tweener.addTween(_mcHeart1,{
- "alpha":0,
- "time":2 * _nTimeFactor,
- "transition":"easeinquart"
- });
- Tweener.addTween(_mcHeart0,{
- "alpha":0,
- "time":1.5 * _nTimeFactor,
- "transition":"easeinquart",
- "onComplete":function():*
- {
- var _loc1_:* = undefined;
- var _loc2_:* = undefined;
- var _loc3_:* = undefined;
- var _loc4_:* = undefined;
- var _loc5_:* = undefined;
- var _loc6_:* = undefined;
- var _loc7_:* = undefined;
- var _loc8_:* = undefined;
- _loc1_ = _dressupmodel.getPart("body").Template.Name;
- _loc2_ = _dressupmodel.PartnerName;
- _loc3_ = Profile.CurrentProfile.Affinities.getPairCounter(_loc1_,_loc2_);
- _loc4_ = (_loc3_ as Number) / (PARTNER_CUTSCENE_2 as Number);
- _mcAffinityBar.setRatio(_loc4_);
- _loc5_ = _mcAffinityBar.x;
- _loc6_ = _mcAffinityBar.y;
- _loc7_ = _mcAffinityBar.scaleX;
- _loc8_ = _mcAffinityBar.scaleY;
- Tweener.removeTweens(_mcAffinityBar);
- _mcAffinityBar.scaleX = _loc7_ * 1.1;
- _mcAffinityBar.scaleY = _loc8_ * 1.1;
- _mcAffinityBar.x -= _mcAffinityBar.width / 8;
- _mcAffinityBar.y -= _mcAffinityBar.height / 8;
- Tweener.addTween(_mcAffinityBar,{
- "scaleX":_loc7_,
- "scaleY":_loc8_,
- "x":_loc5_,
- "y":_loc6_,
- "time":1 * _nTimeFactor
- });
- }
- });
- if(sText != null)
- {
- _tfPartnerChat.text = Localization.getString(sText);
- }
- else
- {
- liketext = Database.getInstance().getPartner(_dressupmodel.PartnerName).getLikeText();
- _tfPartnerChat.text = Localization.getString(liketext);
- if(MainDocument.VOICE_OVERS_ENABLED)
- {
- sc = SoundManager.getInstance().playSound(liketext);
- _aVoiceOvers.push(sc);
- if((Profile.CurrentProfile.TutorialMask & Profile.kTutorial_BoyfriendPopup) == 0 && !bTutorialCher)
- {
- setTutorial(new MCTutorialBoyfriendPopup());
- Profile.CurrentProfile.TutorialMask |= Profile.kTutorial_BoyfriendPopup;
- }
- }
- switch(Profile.CurrentProfile.incrementImpress())
- {
- case 1:
- AchievementsList.showAchievement("head turner");
- Storage.getInstance().saveProfiles();
- break;
- case 20:
- AchievementsList.showAchievement("total betty");
- Storage.getInstance().saveProfiles();
- break;
- case 50:
- AchievementsList.showAchievement("major hottie");
- Storage.getInstance().saveProfiles();
- }
- }
- }
-
- public function init(param1:DressupLevelInfo, param2:DressupModel, param3:DressupTheme) : void
- {
- var sCategory:String = null;
- var part:Part = null;
- var bGoodMatch:Boolean = false;
- var bPartnerAttributesExist:Boolean = false;
- var aPartnerAttributes:Array = null;
- var sPartnerAttribute:String = null;
- var aAttributeList:Array = null;
- var sModel:String = null;
- var sPartner:String = null;
- var iMatches:int = 0;
- var nRatio:Number = NaN;
- var nPartScore:Number = NaN;
- var i:int = 0;
- var scoreeffect:ScoreEffect = null;
- var pStartPoint:Point = null;
- var pEndPoint:Point = null;
- var nEndAlpha:Number = NaN;
- var dressupresultpart:DressupResultPart = null;
- var triple:Triple = null;
- var rule:Rule = null;
- var bMatch:Boolean = false;
- var triple2:Triple = null;
- var sAttribute:String = null;
- var sType:String = null;
- var sPose:String = null;
- var nAdditionalMultiplier:Number = NaN;
- var dli:DressupLevelInfo = param1;
- var dressupmodel:DressupModel = param2;
- var dressuptheme:DressupTheme = param3;
- _mcTop.init("TOPS & DRESSES","",false,"?");
- _mcBottom.init("BOTTOMS","",false,"?");
- _mcShoe.init("FOOTWEAR","",false,"?");
- _mcAccessory.init(dressupmodel.PartnerName.toUpperCase(),"",false,"?");
- _dressuplevelinfo = dli;
- _dressupmodel = dressupmodel;
- _dressuptheme = dressuptheme;
- _mcAccessory._tfLetter.visible = false;
- _mcAccessory._mcDressupResultPartOk.visible = false;
- _mcAccessory._mcDressupResultPartWrong.visible = false;
- _tfModelName.text = Database.getInstance().getPartner(dressupmodel.PartnerName).TargetName;
- _tfTitle1.text = _dressuptheme.Description;
- bTutorialCher = false;
- _mcModel.clone(dressupmodel);
- _mcBackground.addChild(new Bitmap(MainDocument.BackgroundPackage.getImage(dressupmodel.ModelTheme.Background)));
- setBackButton(_bBack);
- installMouseOverSound(_bBack);
- hideExtras();
- if(_dressuplevelinfo.LevelName != "Tutorial")
- {
- bTutorial = false;
- }
- else
- {
- bTutorial = true;
- }
- _mcThumbnail.gotoAndStop(dressupmodel.PartnerName);
- _nFinalScore = 0;
- _nDisplayedScore = 0;
- _nFinalGrade = 0;
- _timer = new Timer(TIMER_INTERVAL);
- _timer.addEventListener(TimerEvent.TIMER,onTimer,false,0,true);
- _nOriginalX = _tfPoints.x;
- _nOriginalY = _tfPoints.y;
- for each(sCategory in ["top","bottom","shoe","accessory","dress","body"])
- {
- part = dressupmodel.getPart(sCategory);
- if(part != null)
- {
- dli.UsedItems.push(part.Template.Name);
- }
- }
- if(!_dressupmodel.isDressed())
- {
- _tfRanOutOfTime.visible = true;
- tweenBonus(_tfRanOutOfTime);
- }
- _aScoreEffects = new Array();
- bGoodMatch = true;
- for each(sCategory in ["top","bottom","shoe","accessory","dress","body"])
- {
- part = _mcModel.getPart(sCategory);
- nPartScore = scorePart(part);
- _nFinalScore += nPartScore;
- if(sCategory == "top" || sCategory == "bottom" || sCategory == "shoe")
- {
- _nFinalGrade += ConvertPartScore(nPartScore);
- }
- if(nPartScore < PART_GOOD_MINIMUM_SCORE && (sCategory == "top" || sCategory == "bottom"))
- {
- bGoodMatch = false;
- }
- if(nPartScore == 0 && (sCategory == "top" || sCategory == "bottom" || sCategory == "shoe"))
- {
- _bCherVONegative = true;
- }
- if(nPartScore < PART_SHOE_GOOD_MINIMUM_SCORE && sCategory == "shoe")
- {
- bGoodMatch = false;
- }
- }
- bPartnerAttributesExist = false;
- aPartnerAttributes = Database.getInstance().getPartner(dressupmodel.PartnerName).likesList(dressupmodel);
- aAttributeList = new Array();
- for each(sPartnerAttribute in aPartnerAttributes)
- {
- aAttributeList.push(sPartnerAttribute);
- }
- for each(sCategory in ["top","bottom","shoe","accessory"])
- {
- part = _mcModel.getPart(sCategory);
- if(part != null)
- {
- i = 0;
- while(i < aAttributeList.length)
- {
- if(aAttributeList[i] != null)
- {
- sPartnerAttribute = aAttributeList[i] as String;
- if(part.Template.hasAttribute(sPartnerAttribute))
- {
- scoreeffect = new ScoreEffect();
- pStartPoint = part.localToGlobal(new Point(part.width / 2,part.height / 2));
- nEndAlpha = 1;
- dressupresultpart = getDestination("boyfriend");
- if(dressupresultpart != null)
- {
- triple = dressupresultpart.getNextCoordinate();
- pEndPoint = new Point(triple.First as Number,triple.Second as Number);
- nEndAlpha = triple.Third as Number;
- }
- else
- {
- pEndPoint = new Point();
- }
- scoreeffect.init("ΓÖÑ " + Database.getInstance().translateAttrib(sPartnerAttribute),BOYFRIEND_ATTRIBUTE_BONUS,pStartPoint,pEndPoint,nEndAlpha,dressupresultpart.onFinishedScoreEffect);
- scoreeffect.setTimeRatio(3 * _nTimeFactor);
- _aScoreEffects.push(scoreeffect);
- _nFinalScore += BOYFRIEND_ATTRIBUTE_BONUS;
- aAttributeList[i] = null;
- }
- }
- i++;
- }
- }
- }
- if(bPartnerAttributesExist)
- {
- }
- _aScoreEffects.push(function():*
- {
- onAttributeScoresDone();
- });
- if(_dressupmodel.ModelTimer.getRatio() > TIMER_HIGH_RATIO)
- {
- _aScoreEffects.push(function():*
- {
- _tfPlusTimer.text = "Time Bonus +" + TIMER_HIGH_BONUS;
- tweenBonus(_tfPlusTimer);
- return TIMER_HIGH_BONUS;
- });
- _nFinalScore += TIMER_HIGH_BONUS;
- }
- else if(_dressupmodel.ModelTimer.getRatio() > TIMER_MID_RATIO)
- {
- _aScoreEffects.push(function():*
- {
- _tfPlusTimer.text = "Time Bonus +" + TIMER_MID_BONUS;
- tweenBonus(_tfPlusTimer);
- return TIMER_MID_BONUS;
- });
- _nFinalScore += TIMER_MID_BONUS;
- }
- if(!bTutorial)
- {
- for each(rule in _dressuplevelinfo.Package.Rules)
- {
- bMatch = true;
- for each(triple2 in rule.Attributes)
- {
- sAttribute = triple2.First as String;
- sType = triple2.Second as String;
- if(sType == "")
- {
- if(!_dressupmodel.isAttributePresent(sAttribute))
- {
- bMatch = false;
- break;
- }
- }
- else if(!_dressupmodel.isAttributePresentInCategory(sAttribute,sType))
- {
- bMatch = false;
- break;
- }
- }
- if(bMatch)
- {
- addScoreDelay();
- enqueueRuleMatch(rule);
- break;
- }
- }
- }
- sModel = _dressupmodel.getPart("body").Template.Name;
- sPartner = _dressupmodel.PartnerName;
- iMatches = Profile.CurrentProfile.Affinities.getPairCounter(sModel,sPartner);
- nRatio = (iMatches as Number) / (PARTNER_CUTSCENE_2 as Number);
- _mcAffinityBar.setRatio(nRatio);
- if(aPartnerAttributes.length >= MIN_LIKE_COUNT && _dressupmodel.isDressed() && !bTutorial)
- {
- _aScoreEffects.push(function():*
- {
- _tfPerfectBonus.text = "Boyfriend Match +" + PARTNER_BONUS + "!";
- tweenBonus(_tfPerfectBonus);
- return PARTNER_BONUS;
- });
- _nFinalScore += PARTNER_BONUS;
- Profile.CurrentProfile.Affinities.incrementPairCounter(sModel,sPartner);
- nCount = Profile.CurrentProfile.Affinities.getPairCounter(sModel,sPartner);
- if(nCount % PARTNER_CHAT_INTERVAL == 0)
- {
- if(nCount == PARTNER_CUTSCENE_2)
- {
- _aScoreEffects.push(function():*
- {
- showBoyFriendCutscene();
- });
- }
- else if(nCount == PARTNER_CUTSCENE_1)
- {
- _aScoreEffects.push(function():*
- {
- showBoyFriendPopup(sPartner);
- });
- }
- else
- {
- addScoreDelay();
- _aScoreEffects.push(function():*
- {
- showPartner(null);
- });
- _bPartnerVO = true;
- }
- }
- if(nCount == PARTNER_CUTSCENE_2)
- {
- AchievementsList.checkAffinities();
- }
- _aScoreEffects.push(function():*
- {
- AchievementsList.incrementPerfect(sPartner);
- });
- }
- if(bGoodMatch && !bTutorial)
- {
- trace("Good match for : " + _dressupmodel.ModelTheme.Title);
- _aScoreEffects.push(function():*
- {
- AchievementsList.incrementOccasionGood(_dressupmodel.ModelTheme.Title);
- });
- }
- if(_dressuplevelinfo.DoubleDamage && _dressuplevelinfo.DoubleDamageTarget.toLowerCase() == _dressupmodel.PartnerName.toLowerCase())
- {
- _aScoreEffects.push(function():*
- {
- tweenBonus(_bDoubleDamage);
- ++_nDisplayedScoreMultiplier;
- return "1";
- });
- ++_nFinalScoreMultiplier;
- _dressuplevelinfo.DoubleDamage = false;
- }
- if(_dressuplevelinfo.LevelPoses.length > 0)
- {
- sPose = _dressuplevelinfo.LevelPoses.pop() as String;
- if(_dressupmodel.getPose() == sPose && checkPoseOrder(_dressuplevelinfo.LevelPoses.length,_dressupmodel.name))
- {
- nAdditionalMultiplier = _dressuplevelinfo.LevelPoseMultiplier;
- switch(_dressuplevelinfo.LevelPoses.length)
- {
- case 0:
- _aScoreEffects.push(function():*
- {
- _tfPlusPose.text = "Pose Bonus +" + nAdditionalMultiplier * 100 + "%";
- tweenBonus(_tfPlusPose);
- SoundManager.getInstance().playSound("PoseMatchSound3");
- return nAdditionalMultiplier.toString();
- });
- break;
- case 1:
- _aScoreEffects.push(function():*
- {
- _tfPlusPose.text = "Pose Bonus +" + nAdditionalMultiplier * 100 + "%";
- tweenBonus(_tfPlusPose);
- SoundManager.getInstance().playSound("PoseMatchSound2");
- return nAdditionalMultiplier.toString();
- });
- break;
- default:
- _aScoreEffects.push(function():*
- {
- _tfPlusPose.text = "Pose Bonus +" + nAdditionalMultiplier * 100 + "%";
- tweenBonus(_tfPlusPose);
- SoundManager.getInstance().playSound("PoseMatchSound1");
- return nAdditionalMultiplier.toString();
- });
- }
- _nFinalScoreMultiplier += nAdditionalMultiplier;
- _dressuplevelinfo.LevelPoseMultiplier += 0.5;
- }
- else
- {
- _dressuplevelinfo.LevelPoses = new Array();
- }
- }
- showPowerup(null);
- _powerup = _dressuplevelinfo.awardPowerup(_nFinalScore * _nFinalScoreMultiplier);
- if(_powerup != null)
- {
- _aScoreEffects.push(function():*
- {
- showPowerup(_powerup);
- });
- }
- _aScoreEffects.push(function():*
- {
- var _loc1_:Number = NaN;
- var _loc2_:Number = NaN;
- var _loc3_:Number = NaN;
- var _loc4_:Number = NaN;
- _loc1_ = _bBack.scaleX;
- _loc2_ = _bBack.scaleY;
- _loc3_ = _tfBack.scaleX;
- _loc4_ = _tfBack.scaleY;
- _bBack.scaleX = _loc1_ * 2;
- _bBack.scaleY = _loc2_ * 2;
- _tfBack.scaleX = _loc3_ * 2;
- _tfBack.scaleY = _loc4_ * 2;
- Tweener.addTween(_bBack,{
- "scaleX":_loc1_,
- "scaleY":_loc2_,
- "time":0.5 * _nTimeFactor
- });
- Tweener.addTween(_tfBack,{
- "scaleX":_loc3_,
- "scaleY":_loc3_,
- "time":0.5 * _nTimeFactor
- });
- });
- _aScoreEffects.reverse();
- _timer.start();
- _dressuplevelinfo.CurrentScore += _nFinalScore * _nFinalScoreMultiplier;
- if(_dressupmodel.isDressed())
- {
- _dressuplevelinfo.TopModels[3].dressupmodel.clone(_dressupmodel);
- _dressuplevelinfo.TopModels[3].Score = _nFinalScore * _nFinalScoreMultiplier;
- _dressuplevelinfo.TopModels.sortOn("Score",[Array.DESCENDING | Array.NUMERIC]);
- }
- }
-
- protected function checkPoseOrder(param1:int, param2:*) : Boolean
- {
- if(2 == param1 && "_model1" == param2 || 1 == param1 && "_model0" == param2 || 0 == param1 && "_model2" == param2)
- {
- return true;
- }
- return false;
- }
-
- public function hidePartner() : void
- {
- _mcPartnerLayer.visible = false;
- }
-
- protected function updateScore(param1:Number) : void
- {
- var _loc2_:TextField = null;
- _tfPoints.text = param1.toString();
- Tweener.removeTweens(_tfPoints);
- _tfPoints.scaleX = 2;
- _tfPoints.scaleY = 2;
- _tfPoints.x -= _tfPoints.width * 3 / 8;
- _tfPoints.y -= _tfPoints.height / 5;
- Tweener.addTween(_tfPoints,{
- "scaleX":1,
- "scaleY":1,
- "x":_nOriginalX,
- "y":_nOriginalY,
- "time":0.5 * _nTimeFactor
- });
- }
-
- protected function onClearPartner(param1:MouseEvent) : void
- {
- this.removeEventListener(MouseEvent.CLICK,onClearPartner,true);
- _mcPartnerChat.visible = false;
- _tfPartnerChat.visible = false;
- Tweener.addTween(_mcPartnerLayer,{
- "alpha":0,
- "time":0.3 * _nTimeFactor,
- "transition":"linear",
- "onComplete":hidePartner
- });
- param1.stopImmediatePropagation();
- if(_emitter != null)
- {
- _emitter.pause();
- }
- _bBack.visible = true;
- _tfBack.visible = true;
- _tfBack.mouseEnabled = false;
- }
-
- protected function showBlast(param1:Number, param2:Number) : void
- {
- var _loc3_:DisplayObjectRenderer = null;
- _emitter = new Emitter();
- _emitter.counter = new Blast(50);
- _emitter.addInitializer(new ImageClasses([KintabLarge,KintabSmall]));
- _emitter.addInitializer(new Position(new PointZone(new Point(param1,param2))));
- _emitter.addInitializer(new Lifetime(6,9));
- _emitter.addAction(new Age());
- _emitter.addAction(new Fade());
- _emitter.addInitializer(new Velocity(new RectangleZone(-50,-100,50,50)));
- _emitter.addAction(new Move());
- _emitter.addAction(new Accelerate(0,50));
- _loc3_ = new DisplayObjectRenderer();
- _emitter.renderer = _loc3_;
- addChild(_loc3_);
- _emitter.start();
- _emitter.runAhead(3);
- trace("Started effect at :" + param1 + "," + param2);
- }
-
- protected function onSkipTutorial(param1:MouseEvent) : void
- {
- Profile.CurrentProfile.SkipTutorial = true;
- onBack(new MouseEvent(""));
- }
-
- protected function addScoreDelay() : void
- {
- _aScoreEffects.push(function():*
- {
- _iEffectDelay = _iScoringSpeed;
- });
- }
-
- public function showBoyFriendPopup(param1:String) : *
- {
- var _loc2_:String = null;
- var _loc3_:String = null;
- var _loc4_:int = 0;
- var _loc5_:Number = NaN;
- var _loc6_:BoyfriendsPopupForm = null;
- _loc2_ = _dressupmodel.getPart("body").Template.Name;
- _loc3_ = _dressupmodel.PartnerName;
- _loc5_ = ((_loc4_ = Profile.CurrentProfile.Affinities.getPairCounter(_loc2_,_loc3_)) as Number) / (PARTNER_CUTSCENE_2 as Number);
- _mcAffinityBar.setRatio(_loc5_);
- SoundManager.getInstance().playSound("BoyfriendLovesOutfitSound");
- (_loc6_ = new BoyfriendsPopupForm()).init(param1);
- BaseForm.setForm(_loc6_,true);
- }
-
- public function showBoyFriendCutscene() : *
- {
- var _loc1_:BFCutsceneForm = null;
- _mcAffinityBar.setRatio(1);
- SoundManager.getInstance().playSound("BoyfriendLovesOutfitSound");
- _loc1_ = new BFCutsceneForm();
- _loc1_.init(_dressupmodel);
- BaseForm.setForm(_loc1_,true);
- }
-
- protected function scorePart(param1:Part) : Number
- {
- var _loc2_:Number = NaN;
- var _loc3_:Array = null;
- var _loc4_:String = null;
- var _loc5_:PartAttribute = null;
- var _loc6_:ScoreEffect = null;
- var _loc7_:Point = null;
- var _loc8_:Point = null;
- var _loc9_:Number = NaN;
- var _loc10_:DressupResultPart = null;
- var _loc11_:Triple = null;
- _loc2_ = 0;
- _loc3_ = new Array();
- if(param1 != null)
- {
- for each(_loc4_ in _dressuptheme.TargetAttributes)
- {
- if(_dressuptheme.Title.toLowerCase().indexOf(_loc4_.toLowerCase()) < 0)
- {
- if(param1.Template.hasAttribute(_loc4_))
- {
- _loc3_.push(param1.Template.getAttribute(_loc4_));
- }
- }
- }
- for each(_loc5_ in _loc3_)
- {
- _loc6_ = new ScoreEffect();
- _loc7_ = param1.localToGlobal(new Point(param1.width / 2,param1.height / 2));
- _loc9_ = 1;
- if((_loc10_ = getDestination(param1.Template.Category)) != null)
- {
- _loc11_ = _loc10_.getNextCoordinate();
- _loc8_ = new Point(_loc11_.First as Number,_loc11_.Second as Number);
- _loc9_ = _loc11_.Third as Number;
- _loc6_.init(_loc5_.Name,_loc5_.Score,_loc7_,_loc8_,_loc9_,_loc10_.onFinishedScoreEffect);
- _loc6_.setTimeRatio(_nTimeFactor);
- }
- else
- {
- _loc8_ = new Point(_loc7_.x,_loc7_.y - 100);
- _loc6_.init(_loc5_.Name + (_loc5_.Score > 0 ? " +" : " -") + _loc5_.Score,_loc5_.Score,_loc7_,_loc8_,0,null);
- _loc6_.setTimeRatio(10 * _nTimeFactor);
- }
- _aScoreEffects.push(_loc6_);
- _loc2_ += _loc5_.Score;
- }
- }
- return _loc2_;
- }
-
- protected function convertGrade(param1:String) : int
- {
- var _loc2_:int = 0;
- switch(param1)
- {
- case "A":
- _loc2_ = 95;
- break;
- case "B":
- _loc2_ = 85;
- break;
- case "C":
- _loc2_ = 75;
- break;
- case "D":
- _loc2_ = 65;
- break;
- default:
- _loc2_ = 55;
- }
- return _loc2_;
- }
- }
- }
-